import Axios from "./core/Axios";
import { AxiosInstance } from "./types";
import { extend } from "./helpers/utils";
// 混合
// axios()
// axios.request()  支持
// axios.get()  支持

function createInstance(): AxiosInstance {
  const context = new Axios();
  const instance = Axios.prototype.request.bind(context);
  extend(instance, Axios.prototype);
  extend(instance, context);
  return instance as AxiosInstance;
}

const axios = createInstance();

export default axios;
